import '../../../../config/address.dart';
import '../../../../tools_base/debug_log.dart';

class AIFaceBill {
  AIFaceBill({
    int? code,
    AiFaceRecordData? data,
    bool? hash,
    String? msg,
    String? time,
    String? tip,
  }) {
    _code = code;
    _data = data;
    _hash = hash;
    _msg = msg;
    _time = time;
    _tip = tip;
  }

  AIFaceBill.fromJson(dynamic json) {
    _code = json['code'];
    _data = json['data'] != null ? AiFaceRecordData.fromJson(json['data']) : null;
    _hash = json['hash'];
    _msg = json['msg'];
    _time = json['time'];
    _tip = json['tip'];
  }
  int? _code;
  AiFaceRecordData? _data;
  bool? _hash;
  String? _msg;
  String? _time;
  String? _tip;

  int? get code => _code;
  AiFaceRecordData? get data => _data;
  bool? get hash => _hash;
  String? get msg => _msg;
  String? get time => _time;
  String? get tip => _tip;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['code'] = _code;
    if (_data != null) {
      map['data'] = _data?.toJson();
    }
    map['hash'] = _hash;
    map['msg'] = _msg;
    map['time'] = _time;
    map['tip'] = _tip;
    return map;
  }
}

class AiFaceRecordData {
  AiFaceRecordData({
    bool? hasNext,
    List<AiFaceRecordDataList>? list,
  }) {
    _hasNext = hasNext;
    _list = list;
  }

  AiFaceRecordData.fromJson(dynamic json) {
    _hasNext = json['hasNext'];
    if (json['list'] != null) {
      _list = [];
      debugLog("fromJson");
      json['list'].forEach((v) {
        _list?.add(AiFaceRecordDataList.fromJson(v));
      });
      debugLog("fromJson end");
    }
  }
  bool? _hasNext;
  List<AiFaceRecordDataList>? _list;

  bool? get hasNext => _hasNext;
  List<AiFaceRecordDataList>? get list => _list;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['hasNext'] = _hasNext;
    if (_list != null) {
      map['list'] = _list?.map((v) => v.toJson()).toList();
    }
    return map;
  }
}

class AiFaceRecordDataList {
  AiFaceRecordDataList({
    String? id,
    int? uid,
    List<String>? picture,
    String? vidId,
    String? mId,
    int? coin,
    int? incomeCoin,
    int? status,
    String? cover,
    String? url,
    String? remark,
    String? createdAt,
    String? spendTime,
    String? modCover,
    String? modPic,
    String? modSourceURL,
    String? updatedAt,
  }) {
    _id = id;
    _uid = uid;
    _picture = picture;
    _vidId = vidId;
    _mId = mId;
    _coin = coin;
    _incomeCoin = incomeCoin;
    _status = status;
    _cover = cover;
    _url = url;
    _remark = remark;
    _createdAt = createdAt;
    _updatedAt = updatedAt;
    _spendTime = spendTime;
    _modSourceURL = modSourceURL;
    _modCover = modCover;
    modPic = modCover;
  }

  AiFaceRecordDataList.fromJson(dynamic json) {
    _id = json['id'];
    _uid = json['uid'];
    _picture = json['picture'] != null ? json['picture'].cast<String>() : [];
    originPic = json['originPic'];
    newPic = json['newPic'] != null ? json['newPic'].cast<String>() : [];
    _vidId = json['vidId'];
    _mId = json['mId'];
    _coin = json['coin'];
    _incomeCoin = json['incomeCoin'];
    _status = json['status'];
    _cover = json['cover'];
    _url = json['url'];
    _remark = json['remark'];
    _createdAt = json['createdAt'];
    _updatedAt = json['updatedAt'];
    _spendTime = json['spendTime'];
    _modCover = json['modCover'];
    modPic = json['modPic'];
    _modSourceURL = json['modSourceURL'];
  }
  String? _id;
  int? _uid;
  List<String>? _picture;
  String? originPic;
  List<String>? newPic;
  String? _vidId;
  String? _mId;
  int? _coin;
  int? _incomeCoin;
  int? _status;
  String? _url;
  String? _remark;
  String? _createdAt;
  String? _spendTime;
  String? _updatedAt;
  String? _modCover;
  String? modPic;
  String? _modSourceURL;
  String? _cover;

  String? get id => _id;
  int? get uid => _uid;
  List<String>? get picture => _picture;
  String? get vidId => _vidId;
  String? get mId => _mId;
  int? get coin => _coin;
  int? get incomeCoin => _incomeCoin;
  int? get status => _status;
  String? get cover => _cover;
  String? get url => _url;
  String? get remark => _remark;
  String? get createdAt => _createdAt;
  String? get updatedAt => _updatedAt;
  String? get spendTime => _spendTime;
  String? get modCover => _modCover;
  String? get modSourceURL => _modSourceURL;

  String get realVideoUrl {
    return "${Address.baseApiPath}/vid/h5/m3u8/$_url?token=${Address.token}";
  }

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['id'] = _id;
    map['uid'] = _uid;
    map['picture'] = _picture;
    map['vidId'] = _vidId;
    map['mId'] = _mId;
    map['coin'] = _coin;
    map['incomeCoin'] = _incomeCoin;
    map['status'] = _status;
    map['cover'] = _cover;
    map['url'] = _url;
    map['remark'] = _remark;
    map['createdAt'] = _createdAt;
    map['updatedAt'] = _updatedAt;
    map['spendTime'] = _spendTime;
    map['modCover'] = _modCover;
    map['modPic'] = modPic;
    map['modSourceURL'] = _modSourceURL;
    return map;
  }
}
